package org.soft.xinyu.equipmentmanagement.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.soft.xinyu.equipmentmanagement.entity.MachineTest;
import org.soft.xinyu.equipmentmanagement.result.Result;
import org.soft.xinyu.equipmentmanagement.service.MachineTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author vicente
 * @since 2021-11-22
 */
@RestController
@RequestMapping("/machine-test")
public class MachineTestController {

    @Autowired
    private MachineTestService machineTestService;

    /**
     * 查询机器检定点记录
     *
     * @param machineId
     * @return
     */
    @GetMapping("/getMachineTestByMachineId")
    public Result<MachineTest> getMachineTestByMachineId(@RequestParam String machineId) {
        MachineTest machineTest = machineTestService.getOne(new QueryWrapper<MachineTest>()
                .lambda()
                .eq(machineId != null || !"".equals(machineId), MachineTest::getMachineId, machineId));
        return Result.success(machineTest);
    }
}
